<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  
  <title>Jailer - JSON/YAML/XML Export</title>
  <meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
  <meta name="description" content="Data Export Tool" />
  <link rel="shortcut icon" href="favicon.ico" />
  <meta name="keywords" content="data export referential integrity java jdbc dbms" />
  <link rel="stylesheet" type="text/css" href="styles.css" />
</head>

<body left-margin="0" top-margin="0">
  <div align="left">
    <table style="text-align: left; position: absolute; left: 0pt; top: 0pt;" border="0"
    cellpadding="0" cellspacing="0" height="407" width="100%">
      <tbody>
        <tr>
          <td colspan="2" class="bannerbackground" height="33" width="100%">
            <table border="0" cellpadding="4" cellspacing="0" width="100%">
              <tbody>
                <tr>
                  <td><a href="https://github.com/Wisser/Jailer"><img src="logo.png" hspace="10" /></td> <td class="slogan" width="100%"></a>

                   

                  <td style="text-align: right; width: 100%;">
                    <table border="0" cellpadding="0" cellspacing="0">
                      <tbody>
                        <tr>
                           <td><a href="https://github.com/Wisser/Jailer"><img src="GitHub-Mark-64px.png" title="GitHub" /></a> </td></tr><tr style="height: 100%;"><td>&nbsp;</td>
                        </tr>
                      </tbody>
                    </table>
                  </td>
                </tr>
              </tbody>
            </table>
          </td>
        </tr>

        <tr>
          <td colspan="2" class="nav1background"  width="100%">&nbsp;
          <b><font color="#FFFFFF"><a href="home.htm" target="_self" class=
          "tlink">&nbsp;Home&nbsp;</a> <a href="quicktour.htm" target="_self"
          class="tlink">&nbsp;Quick Tour&nbsp;</a> <a href="exporting-data.htm"
          target="_self" class="tlinkA">&nbsp;Tutorial&nbsp;</a> <a href=
          "data-browsing.html" target="_self" class="tlink">&nbsp;Data Browser&nbsp;</a> <a class="tlink" href="videos.html" target="_self">&nbsp;Videos&nbsp;</a> 
          <a href="faq.html" target="_self" class="tlink">&nbsp;FAQ&nbsp;</a> 
          <a href="api.html" target="_self" class="tlink">&nbsp;API&nbsp;</a> 
          <a href="design.htm" target="_self" class=
          "tlink">&nbsp;Documentation&nbsp;</a> <a href=
          "http://sourceforge.net/forum/?group_id=197260" target="_self" class=
          "tlink">&nbsp;Forum&nbsp;</a> <a href=
          "http://sourceforge.net/project/showfiles.php?group_id=197260" target="_self"
          class="tlink">&nbsp;Download&nbsp;</a>  &nbsp;&nbsp;&nbsp;
          &nbsp;&nbsp;&nbsp;</font></b></td>
        </tr>

        <tr>
          <td colspan="2" class="spacer" width="100%"></td> </tr><tr><td class="lmenucontainer">&nbsp;</td>
        </tr>

        <tr>
          <td class="lmenucontainer" height="100%" valign="top" width="14%">
            <div align="center">
              <center>
                <table border="0" cellpadding="0" cellspacing="0" width="100%">
                  <tbody>
                    <tr>
                      <td height="6px" width="100%"> </td>
                    </tr>
                  </tbody>
                </table>
              </center>
            </div>

            <ul>
              <li><a href="preparation.htm" target="_self" class="mlink">Preparation</a> </li><br>
              <li>Basic</li>

                <ul>
                  <li><a href="exporting-data.htm" target="_self" class="llink">Exporting Data</a> </li>
                </ul>

                <ul>
                  <li><a href="deleting-data.htm" target="_self" class="llink">Deleting
                  Data</a> </li>
                </ul>
<br>
              <li>Advanced</li>

                <ul>
                  <li><a href="filters.html" target="_self" class=
                  "llink">Filters</a> </li>
                </ul>

                <ul>
                  <li><a href="subset-by-example.html" target="_self" class=
                  "llink">Subset&nbsp;By&nbsp;Example</a> </li>
				  <li><a href="exporting-xml.html" target="_self" class="llinkA">JSON/YAML/XML Export</a> </li>
                </ul>
            </ul>

            <table border="0" cellpadding="5" cellspacing="0" width="100%">
              <tbody>
                <tr>
                  <td class="content2background"><img style="width: 160px; height: 1px;"
                  alt="" src="architecture-Dateien/vgradp.gif" /></td>
                </tr>
              </tbody>
            </table>

            <p>&nbsp;</p>
          </td>

          <td class="contentbackground" height="418" valign="top" width="86%">
            <div align="right">
              <table border="0" cellpadding="0" cellspacing="0" height="542" width="98%">
                <tbody>
                  <tr>
                    <td class="contentbackground" height="21" width="100%">&nbsp;</td>
                  </tr>

                  <tr>
                    <td class="content" height="520" valign="top" width="100%">
                      
                      This tutorial shows you how to export data into XML files and how to define
                      the structure of the documents.<br />
                      The export to JSON or YAML files works in the same way.
                      <br />

                      <h4>Objective</h4>Exporting all the data related to the employee
                      named 'Scott' into a XML document.<br />
                      <br />

                      <h4>Step 1. Switch to XML-mode.<br /></h4>

                      <p>Load the model <big><span style=
                      "font-family: monospace;">Demo-Scott.jm</span></big> and switch to XML mode.<br /></p>

                      <p><img alt="" src="xmlt1.png" /><br /></p>

                      <p><br /></p>

                      <h4>Step 2. Export Scott to flat XML<br /></h4>

                      <p>Export data into a file <a href="scott-1.xml"><img style=
                      "border: 0px solid ; width: 13px; height: 13px;" src=
                      "exporting-data-Dateien/arrow.gif" hspace="4" /><big><span style=
                      "font-family: monospace;"><font size=
                      "4">scott-1.xml</font></span></big></a> . The XML file contains a
                      flat list of all exported rows, starting with rows from subject
                      table followed by all other rows in alphabetical order of their
                      table names.<br />
                      <br /></p>

                      <div id="vc_markup">
                        <pre>
<span class="hl line"> 1 </span><span class="hl kwa">&lt;?xml</span> version=<span class=
"hl str">"1.0"</span> encoding=<span class=
"hl str">"ISO-8859-15"</span>?&gt;<br /><span class="hl line"> 2 </span><span class=
"hl com">&lt;!--</span><br /><span class="hl line"> 3 </span><span class=
"hl com"> generated by Jailer</span><br /><span class="hl line"> 4 <br /></span><span class="hl line"> 5 </span><span class="hl com"> extraction model: EMPLOYEE where T.NAME='SCOTT'</span><br /><span class="hl line"> 6 </span><span class="hl com"> database URL: jdbc:db2://localhost/wisser</span><br /><span class="hl line"> 7 </span><span class="hl com"> database user: scott</span><br /><span class="hl line"> 8 </span><span class="hl com"> Exported Entities: 13</span><br /><span class="hl line"> 9 </span><span class="hl com"> DEPARTMENT 2</span><br /><span class="hl line"> 10 </span><span class="hl com"> EMPLOYEE 3</span><br /><span class="hl line"> 11 </span><span class="hl com"> PROJECT 2</span><br /><span class="hl line"> 12 </span><span class="hl com"> PROJECT_PARTICIPATION 2</span><br /><span class="hl line"> 13 </span><span class="hl com"> ROLE 2</span><br /><span class="hl line"> 14 </span><span class="hl com"> SALARYGRADE 2</span><br /><span class="hl line"> 15 </span><span class="hl com">--&gt;</span><br /><span class="hl line"> 16 </span><span class="hl kwa">&lt;entities&gt;</span><br /><span class="hl line"> 17 </span> <span class="hl kwa"> &lt;employee&gt;</span><br /><span class="hl line"> 18 </span> <span class="hl com"> &lt;!--columns of EMPLOYEE as T--&gt;</span><br /><span class="hl line"> 19 </span> <span class="hl kwa"> &lt;empno&gt;</span><span class="hl num">7788</span><span class="hl kwa">&lt;/empno&gt;</span><br /><span class="hl line"> 20 </span> <span class="hl kwa"> &lt;name&gt;</span>SCOTT<span class="hl kwa">&lt;/name&gt;</span><br /><span class="hl line"> 21 </span> <span class="hl kwa"> &lt;job&gt;</span>ANALYST<span class="hl kwa">&lt;/job&gt;</span><br /><span class="hl line"> 22 </span> <span class="hl kwa"> &lt;boss&gt;</span><span class="hl num">7566</span><span class="hl kwa">&lt;/boss&gt;</span><br /><span class="hl line"> 23 </span> <span class="hl kwa"> &lt;hiredate&gt;</span><span class="hl num">1982</span>-<span class="hl num">12</span>-<span class="hl num">09</span><span class="hl kwa">&lt;/hiredate&gt;</span><br /><span class="hl line"> 24 </span> <span class="hl kwa"> &lt;salary&gt;</span><span class="hl num">3000.00</span><span class="hl kwa">&lt;/salary&gt;</span><br /><span class="hl line"> 25 </span> <span class="hl kwa"> &lt;comm/&gt;</span><br /><span class="hl line"> 26 </span> <span class="hl kwa"> &lt;deptno&gt;</span><span class="hl num">20</span><span class="hl kwa">&lt;/deptno&gt;</span><br /><span class="hl line"> 27 </span> <span class="hl kwa"> &lt;/employee&gt;</span><br /><span class="hl line"> 28 </span> <span class="hl kwa"> &lt;employee&gt;</span><br /><span class="hl line"> 29 </span> <span class="hl com"> &lt;!--columns of EMPLOYEE as T--&gt;</span><br /><span class="hl line"> 30 </span> <span class="hl kwa"> &lt;empno&gt;</span><span class="hl num">7566</span><span class="hl kwa">&lt;/empno&gt;</span><br /><span class="hl line"> 31 </span> <span class="hl kwa"> &lt;name&gt;</span>JONES<span class="hl kwa">&lt;/name&gt;</span><br /><span class="hl line"> 32 </span> <span class="hl kwa"> &lt;job&gt;</span>MANAGER<span class="hl kwa">&lt;/job&gt;</span><br /><span class="hl line"> 33 </span> <span class="hl kwa"> &lt;boss&gt;</span><span class="hl num">7839</span><span class="hl kwa">&lt;/boss&gt;</span><br /><span class="hl line"> 34 </span> <span class="hl kwa"> &lt;hiredate&gt;</span><span class="hl num">1981</span>-<span class="hl num">04</span>-<span class="hl num">02</span><span class="hl kwa">&lt;/hiredate&gt;</span><br /><span class="hl line"> 35 </span> <span class="hl kwa"> &lt;salary&gt;</span><span class="hl num">2975.00</span><span class="hl kwa">&lt;/salary&gt;</span><br /><span class="hl line"> 36 </span> <span class="hl kwa"> &lt;comm/&gt;</span><br /><span class="hl line"> 37 </span> <span class="hl kwa"> &lt;deptno&gt;</span><span class="hl num">20</span><span class="hl kwa">&lt;/deptno&gt;</span><br /><span class="hl line"> 38 </span> <span class="hl kwa"> &lt;/employee&gt;</span><br /><span class="hl line"> ...<br /> 50 </span> <span class="hl kwa">&lt;department&gt;</span><br /><span class="hl line"> 51 </span> <span class="hl com">&lt;!--columns of DEPARTMENT as T--&gt;</span><br /><span class="hl line"> 52 </span> <span class="hl kwa"> &lt;deptno&gt;</span><span class="hl num">20</span><span class="hl kwa">&lt;/deptno&gt;</span><br /><span class="hl line"> 53 </span> <span class="hl kwa"> &lt;name&gt;</span>RESEARCH<span class="hl kwa">&lt;/name&gt;</span><br /><span class="hl line"> 54 </span> <span class="hl kwa"> &lt;location&gt;</span>DALLAS<span class="hl kwa">&lt;/location&gt;</span><br /><span class="hl line"> 55 </span> <span class="hl kwa">&lt;/department&gt;</span><br /><span class="hl line"> 56 </span> <span class="hl kwa"> &lt;department&gt;</span><br /><span class="hl line"> 57 </span> <span class="hl com"> &lt;!--columns of DEPARTMENT as T--&gt;</span><br /><span class="hl line"> 58 </span> <span class="hl kwa"> &lt;deptno&gt;</span><span class="hl num">10</span><span class="hl kwa">&lt;/deptno&gt;</span><br /><span class="hl line"> 59 </span> <span class="hl kwa">&lt;name&gt;</span>ACCOUNTING<span class="hl kwa">&lt;/name&gt;</span><br /><span class="hl line"> 60 </span> <span class="hl kwa"> &lt;location&gt;</span>NEW YORK<span class="hl kwa">&lt;/location&gt;</span><br /><span class="hl line"> 61 </span> <span class="hl kwa"> &lt;/department&gt;</span><br /><span class="hl line"> 62 </span> <span class="hl kwa"> &lt;project&gt;</span><br /><span class="hl line"> 63 </span> <span class="hl com"> &lt;!--columns of PROJECT as T--&gt;</span><br /><span class="hl line"> 64 </span> <span class="hl kwa">&lt;projectno&gt;</span><span class="hl num">1001</span><span class="hl kwa">&lt;/projectno&gt;</span><br /><span class="hl line"> 65 </span> <span class="hl kwa"> &lt;description&gt;</span>Development of Novel Magnetic Suspension System<span class="hl kwa">&lt;/description&gt;</span><br /><span class="hl line"> 66 </span> <span class="hl kwa"> &lt;start_date&gt;</span><span class="hl num">2006</span>-<span class="hl num">01</span>-<span class="hl num">01</span><span class="hl kwa">&lt;/start_date&gt;</span><br /><span class="hl line"> 67 </span> <span class="hl kwa"> &lt;end_date&gt;</span><span class="hl num">2007</span>-<span class="hl num">08</span>-<span class="hl num">13</span><span class="hl kwa">&lt;/end_date&gt;</span><br /><span class="hl line"> 68 </span> <span class="hl kwa"> &lt;/project&gt;</span><br /><span class="hl line"> 69 </span> <span class="hl kwa"> &lt;project&gt;</span><br /><span class="hl line"> 70 </span> <span class="hl com"> &lt;!--columns of PROJECT as T--&gt;</span><br /><span class="hl line"> 71 </span> <span class="hl kwa"> &lt;projectno&gt;</span><span class="hl num">1003</span><span class="hl kwa">&lt;/projectno&gt;</span><br /><span class="hl line"> 72 </span> <span class="hl kwa"> &lt;description&gt;</span>Foundation of Quantum Technology<span class="hl kwa">&lt;/description&gt;</span><br /><span class="hl line"> 73 </span> <span class="hl kwa"> &lt;start_date&gt;</span><span class="hl num">2007</span>-<span class="hl num">02</span>-<span class="hl num">24</span><span class="hl kwa">&lt;/start_date&gt;</span><br /><span class="hl line"> 74 </span> <span class="hl kwa"> &lt;end_date&gt;</span><span class="hl num">2008</span>-<span class="hl num">07</span>-<span class="hl num">31</span><span class="hl kwa">&lt;/end_date&gt;</span><br /><span class="hl line"> 75 </span> <span class="hl kwa"> &lt;/project&gt;</span><br /><span class="hl line"> 76 </span> <span class="hl kwa"> &lt;project_participation&gt;</span><br /><span class="hl line"> 77 </span> <span class="hl com"> &lt;!--columns of PROJECT_PARTICIPATION as T--&gt;</span><br /><span class="hl line"> 78 </span> <span class="hl kwa"> &lt;projectno&gt;</span><span class="hl num">1001</span><span class="hl kwa">&lt;/projectno&gt;</span><br /><span class="hl line"> 79 </span> <span class="hl kwa"> &lt;empno&gt;</span><span class="hl num">7788</span><span class="hl kwa">&lt;/empno&gt;</span><br /><span class="hl line"> 80 </span> <span class="hl kwa"> &lt;start_date&gt;</span><span class="hl num">2006</span>-<span class="hl num">05</span>-<span class="hl num">15</span><span class="hl kwa">&lt;/start_date&gt;</span><br /><span class="hl line"> 81 </span> <span class="hl kwa"> &lt;end_date&gt;</span><span class="hl num">2006</span>-<span class="hl num">11</span>-<span class="hl num">01</span><span class="hl kwa">&lt;/end_date&gt;</span><br /><span class="hl line"> 82 </span> <span class="hl kwa"> &lt;role_id&gt;</span><span class="hl num">100</span><span class="hl kwa">&lt;/role_id&gt;</span><br /><span class="hl line"> 83 </span> <span class="hl kwa"> &lt;/project_participation&gt;</span><br /><span class="hl line"> </span><span class="hl line">...<br /> </span><span class="hl line">92 </span> <span class="hl kwa"> &lt;role&gt;</span><br /><span class="hl line"> </span><span class="hl line">93 </span> <span class="hl com"> &lt;!--columns of ROLE as T--&gt;</span><br /><span class="hl line"> 94 </span> <span class="hl kwa">&lt;role_id&gt;</span><span class="hl num">100</span><span class="hl kwa">&lt;/role_id&gt;</span><br /><span class="hl line"> 95 </span> <span class="hl kwa"> &lt;description&gt;</span>Developer<span class="hl kwa">&lt;/description&gt;</span><br /><span class="hl line"> 96 </span> <span class="hl kwa"> &lt;/role&gt;</span>
<span class="hl line"> ...</span><br /> 
</pre>
                      </div>

                      <h4>Step 3. Defining the structure</h4>

                      <p>You can now specify for each association whether it is an aggregation. If an association from table A to B is an aggregation, the XML (JSON/YAML) representations of the entities from table B are embedded into the XML representation of the associated entities from table A.<br /></p>

                      <p>Define the following associations as aggregations (as 'implicit list'):<br /></p>

                      <ul>
                        <li>BOSS (from EMPLOYEE to EMPLOYEE)</li>

                        <li>from EMPLOYEE to DEPARTMENT</li>

                        <li>from EMPLOYEE to SALARYGRADE. Change the tag name to
                        <span style="font-style: italic;">salary_grade</span>.<br />
                        <br /></li>
                      </ul>Define the following associations as aggregations (as 'explicit list'):<br />

                      <ul>
                        <li>from EMPLOYEE to PROJECT_PARTICIPATION<br />
                        <br /></li>
                      </ul>and the following associations as 'flat' aggregations:

                      <ul>
                        <li>from EMPLOYEE to PROJECT_PARTICIPATION</li>

                        <li>from PROJECT_PARTICIPATION to PROJECT</li>

                        <li>from PROJECT_PARTICIPATION to ROLE<br /></li>
                      </ul><br />
                      <img alt="" src="xmlt2.png" /><br />

                      <p><br />
                      Export data into a file <a href="scott-2.xml"><img style=
                      "border: 0px solid ;" src="exporting-data-Dateien/arrow.gif"
                      hspace="4" /><big><span style="font-family: monospace;"><font size=
                      "4">scott-2.xml</font></span></big></a> . The department, the
                      salary-grade, the boss and the project participations are now
                      embedded into the employee-elements. Columns from Project and Role
                      are embedded directly into the elements of the project
                      participations.</p>

                      <div id="vc_markup">
                        <pre>
<span class="hl line"> 1 </span><span class="hl kwa">&lt;?xml</span> version=<span class=
"hl str">"1.0"</span> encoding=<span class=
"hl str">"ISO-8859-15"</span>?&gt;<br /><span class="hl line"> 2 </span><span class=
"hl com">&lt;!--</span><br /><span class="hl line"> 3 </span><span class=
"hl com"> generated by Jailer</span><br /><span class="hl line"> 4 </span><br /><span class="hl line"> 5 </span><span class="hl com"> extraction model: EMPLOYEE where T.NAME='SCOTT'</span><br /><span class="hl line"> 6 </span><span class="hl com"> database URL: jdbc:db2://localhost/wisser</span><br /><span class="hl line"> 7 </span><span class="hl com"> database user: scott</span><br /><span class="hl line"> 8 </span><span class="hl com"> Exported Entities: 13</span><br /><span class="hl line"> 9 </span><span class="hl com"> DEPARTMENT 2</span><br /><span class="hl line"> 10 </span><span class="hl com"> EMPLOYEE 3</span><br /><span class="hl line"> 11 </span><span class="hl com"> PROJECT 2</span><br /><span class="hl line"> 12 </span><span class="hl com"> PROJECT_PARTICIPATION 2</span><br /><span class="hl line"> 13 </span><span class="hl com"> ROLE 2</span><br /><span class="hl line"> 14 </span><span class="hl com"> SALARYGRADE 2</span><br /><span class="hl line"> 15 </span><span class="hl com">--&gt;</span><br /><span class="hl line"> 16 </span><span class="hl kwa">&lt;entities&gt;</span><br /><span class="hl line"> 17 </span> <span class="hl kwa">&lt;employee&gt;</span><br /><span class="hl line"> 18 </span><span style="font-family: mon;"><span style="font-style: italic;"> </span></span><span class="hl com">&lt;!--columns of EMPLOYEE as T--&gt;</span><br /><span class="hl line"> 19 </span> <span class="hl kwa">&lt;empno&gt;</span><span class="hl num">7788</span><span class="hl kwa">&lt;/empno&gt;</span><br /><span class="hl line"> 20 </span> <span class="hl kwa">&lt;name&gt;</span>SCOTT<span class="hl kwa">&lt;/name&gt;</span><br /><span class="hl line"> 21 </span> <span class="hl kwa"> &lt;job&gt;</span>ANALYST<span class="hl kwa">&lt;/job&gt;</span><br /><span class="hl line"> 22 </span> <span class="hl kwa"> &lt;boss&gt;</span><span class="hl num">7566</span><span class="hl kwa">&lt;/boss&gt;</span><br /><span class="hl line"> 23 </span> <span class="hl kwa">&lt;hiredate&gt;</span><span class="hl num">1982</span>-<span class="hl num">12</span>-<span class="hl num">09</span><span class="hl kwa">&lt;/hiredate&gt;</span><br /><span class="hl line"> 24 </span> <span class="hl kwa"> &lt;salary&gt;</span><span class="hl num">3000.00</span><span class="hl kwa">&lt;/salary&gt;</span><br /><span class="hl line"> 25 </span> <span class="hl kwa">&lt;comm/&gt;</span><br /><span class="hl line"> 26 </span> <span class="hl kwa"> &lt;deptno&gt;</span><span class="hl num">20</span><span class="hl kwa">&lt;/deptno&gt;</span><br /><span class="hl line"> 27 </span> <span class="hl com"> &lt;!--associated SALARYGRADE row--&gt;</span><br /><span class="hl line"> 28 </span> <span class="hl kwa"> &lt;salary_grade&gt;</span><br /><span class="hl line"> 29 </span> <span class="hl com"> &lt;!--columns of SALARYGRADE as T--&gt;</span><br /><span class="hl line"> 30 </span> <span class="hl kwa"> &lt;grade&gt;</span><span class="hl num">4</span><span class="hl kwa">&lt;/grade&gt;</span><br /><span class="hl line"> 31 </span> <span class="hl kwa"> &lt;losal&gt;</span><span class="hl num">2001</span><span class="hl kwa">&lt;/losal&gt;</span><br /><span class="hl line"> 32 </span> <span class="hl kwa"> &lt;hisal&gt;</span><span class="hl num">3000</span><span class="hl kwa">&lt;/hisal&gt;</span><br /><span class="hl line"> 33 </span> <span class="hl kwa"> &lt;/salary_grade&gt;</span><br /><span class="hl line"> 34 </span> <span class="hl com"> &lt;!--associated DEPARTMENT row--&gt;</span><br /><span class="hl line"> 35 </span> <span class="hl kwa"> &lt;department&gt;</span><br /><span class="hl line"> 36 </span> <span class="hl com"> &lt;!--columns of DEPARTMENT as T--&gt;</span><br /><span class="hl line"> 37 </span> <span class="hl kwa"> &lt;deptno&gt;</span><span class="hl num">20</span><span class="hl kwa">&lt;/deptno&gt;</span><br /><span class="hl line"> 38 </span> <span class="hl kwa"> &lt;name&gt;</span>RESEARCH<span class="hl kwa">&lt;/name&gt;</span><br /><span class="hl line"> 39 </span> <span class="hl kwa"> &lt;location&gt;</span>DALLAS<span class="hl kwa">&lt;/location&gt;</span><br /><span class="hl line"> 40 </span> <span class="hl kwa"> &lt;/department&gt;</span><br /><span class="hl line"> 41 </span> <span class="hl com"> &lt;!--associated EMPLOYEE row--&gt;</span><br /><span class="hl line"> 42 </span> <span class="hl kwa"> &lt;boss&gt;</span><br /><span class="hl line"> 43 </span> <span class="hl com"> &lt;!--columns of EMPLOYEE as T--&gt;</span><br /><span class="hl line"> ...<br /></span><span class="hl line"> 116 </span> <span class="hl kwa"> &lt;/boss&gt;</span><br /><span class="hl line"> 117 </span> <span class="hl com"> &lt;!--associated PROJECT_PARTICIPATION rows--&gt;</span><br /><span class="hl line"> 118 </span> <span class="hl kwa"> &lt;participations&gt;</span><br /><span class="hl line"> 119 </span> <span class="hl kwa"> &lt;project_participation&gt;</span><br /><span class="hl line"> 120 </span> <span class="hl com"> &lt;!--columns of PROJECT_PARTICIPATION as T--&gt;</span><br /><span class="hl line"> 121 </span> <span class="hl kwa"> &lt;projectno&gt;</span><span class="hl num">1001</span><span class="hl kwa">&lt;/projectno&gt;</span><br /><span class="hl line"> 122 </span> <span class="hl kwa"> &lt;empno&gt;</span><span class="hl num">7788</span><span class="hl kwa">&lt;/empno&gt;</span><br /><span class="hl line"> 123 </span> <span class="hl kwa"> &lt;start_date&gt;</span><span class="hl num">2006</span>-<span class="hl num">05</span>-<span class="hl num">15</span><span class="hl kwa">&lt;/start_date&gt;</span><br /><span class="hl line"> 124 </span> <span class="hl kwa"> &lt;end_date&gt;</span><span class="hl num">2006</span>-<span class="hl num">11</span>-<span class="hl num">01</span><span class="hl kwa">&lt;/end_date&gt;</span><br /><span class="hl line"> 125 </span> <span class="hl kwa">&lt;role_id&gt;</span><span class="hl num">100</span><span class="hl kwa">&lt;/role_id&gt;</span><br /><span class="hl line"> 126 </span> <span class="hl com"> &lt;!--associated ROLE row--&gt;</span><br /><span class="hl line"> 127 </span> <span class="hl com"> &lt;!--columns of ROLE as T--&gt;</span><br /><span class="hl line"> 128 </span> <span class="hl kwa">&lt;role_id&gt;</span><span class="hl num">100</span><span class="hl kwa">&lt;/role_id&gt;</span><br /><span class="hl line"> 129 </span> <span class="hl kwa"> &lt;description&gt;</span>Developer<span class="hl kwa">&lt;/description&gt;</span><br /><span class="hl line"> 130 </span> <span class="hl com">&lt;!--associated PROJECT row--&gt;</span><br /><span class="hl line"> 131 </span> <span class="hl com"> &lt;!--columns of PROJECT as T--&gt;</span><br /><span class="hl line"> 132 </span> <span class="hl kwa"> &lt;projectno&gt;</span><span class="hl num">1001</span><span class="hl kwa">&lt;/projectno&gt;</span><br /><span class="hl line"> 133 </span> <span class="hl kwa"> &lt;description&gt;</span>Development of Novel Magnetic Suspension System<span class="hl kwa">&lt;/description&gt;</span><br /><span class="hl line"> 134 </span> <span class="hl kwa"> &lt;start_date&gt;</span><span class="hl num">2006</span>-<span class="hl num">01</span>-<span class="hl num">01</span><span class="hl kwa">&lt;/start_date&gt;</span><br /><span class="hl line"> 135 </span> <span class="hl kwa"> &lt;end_date&gt;</span><span class="hl num">2007</span>-<span class="hl num">08</span>-<span class="hl num">13</span><span class="hl kwa">&lt;/end_date&gt;</span><br /><span class="hl line"> 136 </span> <span class="hl kwa"> &lt;/project_participation&gt;</span><br /><span class="hl line"> 137 </span> <span class="hl kwa"> &lt;/participations&gt;</span><br /><span class="hl line"> 138 </span> <span class="hl kwa">&lt;/employee&gt;</span><br /><span class="hl line"> 139 </span><span class="hl kwa">&lt;/entities&gt;</span><br /><br />
</pre>
                      </div>
                    </td>
                  </tr>
                </tbody>
              </table>
            </div>

            <h4>Step 3. Defining the column mapping</h4>The "XML Column Mapping" dialog
            allows you to define how columns will be mapped to XML elements or
            attributes. By default each column is mapped to an element with the same
            name. You can open the dialog using the "<span style=
            "font-style: italic;">Column Mapping ...</span>" button or via the context menu of a
            table.<br />
            <br />
            The <span style="font-style: italic;">column mapping template</span> of a
            table describes the XML (JSON/YAML) represenation of each exported row:<br />

            <ul>
              <li><p>Expressions starting with <span style="font-style: italic;"><font color="#0000bb">SQL:</font></span>
              will be replaced by the value of the SQL expression thereafter.
              <span style="font-style: italic;"><font color="#0000bb">T</font></span> is the alias for the row. Note
              that even scalar subqueries are allowed here.</p></li>

              <li><p>Expressions that do not start with <span style="font-style: italic;"><font color="#0000bb">SQL:</font></span> are included directly as constants in the representation. 
              </p></li>

              <li><p><span style="font-style: italic;"><font color="#0000bb">j:assoc</font></span> elements will be
              replaced by the representation of the associated rows.</p></li>
              
              <li><p>An <span style="font-style: italic;"><font color="#0000bb">j:if-not-null</font></span> attribute determines whether an element should should occur in the result. <br>
              The attribute value is an SQL expression (analogous to the expressions after <span style="font-style: italic;"><font color="#0000bb">SQL:</font></span>).<br>
              If it evaluates to <span style="font-style: italic;"><font color="#0000bb">null</font></span>, the element is omitted. The <span style="font-style: italic;"><font color="#0000bb">j:if-null</font></span> attributes work in the opposite way.
             </p> </li>
            </ul>In addition, parameters can be used here, to which values can then be assigned in the "Export Data" dialog or via CLI.<br /><br />
            We change the mapping in the following way:<br />

            <ol>
              <li>Foreign keys should not appear in the XML document as they are
              redundant.<br /></li>

              <li>Map primary keys to attributes rather than elements. (Attributes are not supported in JSON or YAML files!)</li>

              <li>Some elements of ROLE and PROJECT should be renamed. Their names are
              not unique due to the flat embedding into PROJECT_PARTICIPATION:<br />

                <ul>
                  <li>Rename the ROLE-tag <span style=
                  "font-style: italic;">'description'</span> into <span style=
                  "font-style: italic;">'role_description'</span><br /></li>

                  <li>Rename the PROJECT-tag <span style=
                  "font-style: italic;">'description'</span> into <span style=
                  "font-style: italic;">'project_description'</span></li>

                  <li>Rename the PROJECT-tag <span style=
                  "font-style: italic;">'start_date'</span> into <span style=
                  "font-style: italic;">'project_start_date'</span></li>

                  <li>Rename the PROJECT-tag <span style=
                  "font-style: italic;">'end_date'</span> into <span style=
                  "font-style: italic;">'project_end_date'</span></li>
                </ul>
              </li>
            </ol><br />
            Open the Column Mapping dialog for table EMPLYOEE:<br />
            <br />
            <img alt="" src="xmlt3.png" /><br />
            <br />
            Remove the elements <span style="font-style: italic;">'empno',</span>
            <span style="font-style: italic;">'boss'</span> and <span style=
            "font-style: italic;">'deptno'.</span> Add attribute <span style=
            "font-style: italic;">empno="SQL:T.EMPNO"</span> to the root element.<br />
            <br />
            Open the mapping dialog for table DEPARTMENT. Remove element <span style=
            "font-style: italic;">deptno</span> and add attribute <span style=
            "font-style: italic;">deptno="SQL:T.DEPTNO"</span> to the root element.<br />
            <br />
            Remove element <span style="font-style: italic;">grade</span> from column
            mapping template of table SALARY_GRADE and add the attribute <span style=
            "font-style: italic;">grade="SQL:T.GRADE"</span> to the root element.<br />
            <br />
            Remove elements <span style="font-style: italic;">projectno, empno</span> and
            <span style="font-style: italic;">role_id</span> from column mapping template
            of table PROJECT_PARTICIPATION.<br />
            <br />
            Remove element <span style="font-style: italic;">projectno</span> from column
            mapping template of table PROJECT. Rename <span style=
            "font-style: italic;">description,</span> <span style=
            "font-style: italic;">start_date</span> and <span style=
            "font-style: italic;">end_date</span> into <span style=
            "font-style: italic;">project_description,</span> <span style=
            "font-style: italic;">project_start_date</span> and <span style=
            "font-style: italic;">project_end_date.</span><br />
            <br />
            Remove element <span style="font-style: italic;">role_id</span> from column
            mapping template of table ROLE. Rename <span style=
            "font-style: italic;">description</span> into <span style=
            "font-style: italic;">role_description</span><span style=
            "font-style: italic;">.</span> Export data into a file <a href=
            "scott-3.xml"><img style="border: 0px solid ;" src=
            "exporting-data-Dateien/arrow.gif" hspace="4" /><big><span style=
            "font-family: monospace;"><font size=
            "4">scott-3.xml</font></span></big></a> .<br />
            <br />

            <div id="vc_markup">
              <pre>
<span class="hl line"> 1 </span><span class="hl kwa">&lt;?xml</span> version=<span class=
"hl str">"1.0"</span> encoding=<span class=
"hl str">"ISO-8859-15"</span>?&gt;<br /><span class="hl line"> 2 </span><span class=
"hl com">&lt;!--</span><br /><span class="hl line"> 3 </span><span class=
"hl com"> generated by Jailer</span><br /><span class="hl line"> 4 </span><br /><span class="hl line"> 5 </span><span class="hl com"> extraction model: EMPLOYEE where T.NAME='SCOTT'</span><br /><span class="hl line"> 6 </span><span class="hl com"> database URL: jdbc:db2://localhost/wisser</span><br /><span class="hl line"> 7 </span><span class="hl com"> database user: scott</span><br /><span class="hl line"> 8 </span><span class="hl com"> Exported Entities: 13</span><br /><span class="hl line"> 9 </span><span class="hl com"> DEPARTMENT 2</span><br /><span class="hl line"> 10 </span><span class="hl com"> EMPLOYEE 3</span><br /><span class="hl line"> 11 </span><span class="hl com"> PROJECT 2</span><br /><span class="hl line"> 12 </span><span class="hl com"> PROJECT_PARTICIPATION 2</span><br /><span class="hl line"> 13 </span><span class="hl com"> ROLE 2</span><br /><span class="hl line"> 14 </span><span class="hl com"> SALARYGRADE 2</span><br /><span class="hl line"> 15 </span><span class="hl com">--&gt;</span><br /><span class="hl line"> 16 </span><span class="hl kwa">&lt;entities&gt;</span><br /><span class="hl line"> 17 </span> <span class="hl kwa">&lt;employee</span> empno=<span class="hl str">"7788"</span>&gt;<br /><span class="hl line"> 18 </span> <span class="hl com">&lt;!--columns of EMPLOYEE as T--&gt;</span><br /><span class="hl line"> 19 </span> <span class="hl kwa">&lt;name&gt;</span>SCOTT<span class="hl kwa">&lt;/name&gt;</span><br /><span class="hl line"> 20 </span> <span class="hl kwa">&lt;job&gt;</span>ANALYST<span class="hl kwa">&lt;/job&gt;</span><br /><span class="hl line"> 21 </span> <span class="hl kwa">&lt;hiredate&gt;</span><span class="hl num">1982</span>-<span class="hl num">12</span>-<span class="hl num">09</span><span class="hl kwa">&lt;/hiredate&gt;</span><br /><span class="hl line"> 22 </span> <span class="hl kwa">&lt;comm/&gt;</span><br /><span class="hl line"> 23 </span> <span class="hl com">&lt;!--associated SALARYGRADE row--&gt;</span><br /><span class="hl line"> 24 </span> <span class="hl kwa">&lt;salary_grade</span> grade=<span class="hl str">"4"</span>&gt;<br /><span class="hl line"> 25 </span> <span class="hl com">&lt;!--columns of SALARYGRADE as T--&gt;</span><br /><span class="hl line"> 26 </span> <span class="hl kwa">&lt;losal&gt;</span><span class="hl num">2001</span><span class="hl kwa">&lt;/losal&gt;</span><br /><span class="hl line"> 27 </span> <span class="hl kwa">&lt;hisal&gt;</span><span class="hl num">3000</span><span class="hl kwa">&lt;/hisal&gt;</span><br /><span class="hl line"> 28 </span> <span class="hl kwa">&lt;/salary_grade&gt;</span><br /><span class="hl line"> 29 </span> <span class="hl com">&lt;!--associated DEPARTMENT row--&gt;</span><br /><span class="hl line"> 30 </span> <span class="hl kwa">&lt;department</span> deptno=<span class="hl str">"20"</span>&gt;<br /><span class="hl line"> 31 </span> <span class="hl com">&lt;!--columns of DEPARTMENT as T--&gt;</span><br /><span class="hl line"> 32 </span> <span class="hl kwa">&lt;name&gt;</span>RESEARCH<span class="hl kwa">&lt;/name&gt;</span><br /><span class="hl line"> 33 </span> <span class="hl kwa">&lt;location&gt;</span>DALLAS<span class="hl kwa">&lt;/location&gt;</span><br /><span class="hl line"> 34 </span> <span class="hl kwa">&lt;/department&gt;</span><br /><span class="hl line"> 35 </span> <span class="hl com">&lt;!--associated EMPLOYEE row--&gt;</span><br /><span class="hl line"> 36 </span> <span class="hl kwa">&lt;boss</span> empno=<span class="hl str">"7566"</span>&gt;<br /> ...<br /><span class="hl line"> 93 </span> <span class="hl kwa">&lt;/boss&gt;</span><br /><span class="hl line"> 94 </span> <span class="hl com">&lt;!--associated PROJECT_PARTICIPATION rows--&gt;</span><br /><span class="hl line"> 95 </span> <span class="hl kwa">&lt;participations&gt;</span><br /><span class="hl line"> 96 </span> <span class="hl kwa">&lt;project_participation&gt;</span><br /><span class="hl line"> 97 </span> <span class="hl com">&lt;!--columns of PROJECT_PARTICIPATION as T--&gt;</span><br /><span class="hl line"> 98 </span> <span class="hl kwa">&lt;start_date&gt;</span><span class="hl num">2006</span>-<span class="hl num">05</span>-<span class="hl num">15</span><span class="hl kwa">&lt;/start_date&gt;</span><br /><span class="hl line"> 99 </span> <span class="hl kwa">&lt;end_date&gt;</span><span class="hl num">2006</span>-<span class="hl num">11</span>-<span class="hl num">01</span><span class="hl kwa">&lt;/end_date&gt;</span><br /><span class="hl line"> 100 </span> <span class="hl com">&lt;!--associated ROLE row--&gt;</span><br /><span class="hl line"> 101 </span> <span class="hl com">&lt;!--columns of ROLE as T--&gt;</span><br /><span class="hl line"> 102 </span> <span class="hl kwa">&lt;role_description&gt;</span>Developer<span class="hl kwa">&lt;/role_description&gt;</span><br /><span class="hl line"> 103 </span> <span class="hl com">&lt;!--associated PROJECT row--&gt;</span><br /><span class="hl line"> 104 </span> <span class="hl com">&lt;!--columns of PROJECT as T--&gt;</span><br /><span class="hl line"> 105 </span> <span class="hl kwa">&lt;project_description&gt;</span>Development of Novel Magnetic Suspension System<span class="hl kwa">&lt;/project_description&gt;</span><br /><span class="hl line"> 106 </span> <span class="hl kwa">&lt;project_start_date&gt;</span><span class="hl num">2006</span>-<span class="hl num">01</span>-<span class="hl num">01</span><span class="hl kwa">&lt;/project_start_date&gt;</span><br /><span class="hl line"> 107 </span> <span class="hl kwa">&lt;project_end_date&gt;</span><span class="hl num">2007</span>-<span class="hl num">08</span>-<span class="hl num">13</span><span class="hl kwa">&lt;/project_end_date&gt;</span><br /><span class="hl line"> 108 </span> <span class="hl kwa">&lt;/project_participation&gt;</span><br /><span class="hl line"> 109 </span> <span class="hl kwa">&lt;/participations&gt;</span><br /><span class="hl line"> 110 </span> <span class="hl kwa">&lt;/employee&gt;</span><br /><span class="hl line"> 111 </span><span class="hl kwa">&lt;/entities&gt;</span><br /><br />
</pre>
            </div><br />

            <h4>Step 4. Export entire employee hierarchy</h4>Finally we export all
            employees into a XML tree with the president as root and subordinates as the
            children.<br />
            Do the following:<br />

            <ul>
              <li>Define the 'BOSS' to 'BOSS' association on the "parent" (red) side to become an aggregation. (The aggregation on the opposite side is then automatically removed).<br>
              </li>
              <li>Use the "Column Mapping for EMPLOYEE" dialog to set the name of the 'inverse-BOSS' association to 'subordinates'.</li>

              <li>remove the restriction from 'inverse-BOSS' association (the "child" side).<br /></li>

              <li>set where-condition to T.NAME='KING'.</li>
            </ul>Export data into a file <a href="scott-4.xml"><img style=
            "border: 0px solid ; width: 13px; height: 13px;" src=
            "exporting-data-Dateien/arrow.gif" hspace="4" /><big><span style=
            "font-family: monospace;"><font size=
            "4">scott-4.xml</font></span></big></a> .<br />
            <br />
          </td>
        </tr>

        <tr>
          <td height="12" valign="top" width="14%"><br /></td>

          <td><br /></td>
        </tr>
      </tbody>
    </table>
  </div>
</body>
</html>
